from typing import Any

class AppException(Exception):
    """基础异常类"""
    def __init__(self, status_code: int, message: str, data: Any = None):
        self.status_code = status_code
        self.message = message
        self.data = data
        super().__init__(self.message)

class AuthenticationError(AppException):
    """认证异常（未登录）"""
    def __init__(self, message: str = "未登录或令牌已过期", data: Any = None):
        super().__init__(status_code=401, message=message, data=data)

class AuthorizationError(AppException):
    """权限异常"""
    def __init__(self, message: str = "没有足够的权限执行此操作", data: Any = None):
        super().__init__(status_code=403, message=message, data=data)

class ParameterError(AppException):
    """参数异常"""
    def __init__(self, message: str = "参数错误", data: Any = None):
        super().__init__(status_code=400, message=message, data=data)

class ResourceNotFoundError(AppException):
    """资源不存在异常"""
    def __init__(self, message: str = "请求的资源不存在", data: Any = None):
        super().__init__(status_code=404, message=message, data=data)
